# Maintainer : Geoffroy Carrier <gcarrier@aur.archlinux.org>
# Contributor: Joel Schaerer <joel.schaerer@laposte.net>

pkgname=slimevolley
pkgver=2.4.2
pkgrel=5
pkgdesc="A simple yet fun arcade volley game"
arch=('loong64' 'x86_64')
url="https://slime.tuxfamily.org/index.php"
license=('GPL')
depends=('sdl_net' 'sdl_ttf' 'sdl_image')
makedepends=('cmake')
source=("https://downloads.tuxfamily.org/slime/v242/${pkgname}_${pkgver}.tar.bz2"
        link-libm.patch)
sha512sums=('7a72329d9e22396f2e304d40370896b2c1a0ae22d5bf1769a46cad8fb1131b1ae9c16de0e5f847b8a31004df074cdeb710a28bfd1e1d94beceb1c8eb0a750680'
            '61b09d65af465637d5c1d22306cc412f742b19ef58243d9df033a931ae9a2002123da393a91214999275c6801335ebcae9554cf4a4ce7a94b7cfef954bd6dc8c')

prepare() {
  cd "$srcdir/$pkgname"
  patch -Np1 -i ../link-libm.patch
}

build() {
  cd "$srcdir/$pkgname"
  CFLAGS+=' -fcommon' # https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common
  cmake -DCMAKE_INSTALL_PREFIX:FILEPATH=/usr .
  make
}

package() {
  cd "$srcdir/$pkgname"

  make DESTDIR="${pkgdir}" install
}
